<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>订单添加</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-offset-3 col-md-6">
            <div class="page-header">
                <h2>
                    <small>
                        添加订单信息
                    </small>
                </h2>
            </div>
        </div>
    </div>

    <div class="row clearfix">
        <div class="col-md-offset-3 col-md-6">
            <form action="${pageContext.request.contextPath}/user/billDo/addBill?billCode=${billCode}" method="post">
                <div class="form-group">
                    <label for="billCode">订单编码：</label>
                    <input type="text" name="billCode" id="billCode" class="form-control" value="${billCode}" disabled>
                </div>
                <div class="form-group">
                    <label for="productName">商品名称：</label>
                    <input type="text" name="productName" id="productName" class="form-control" placeholder="productName" required>
                </div>
                <div class="form-group">
                    <label for="productUnit">商品单位：</label>
                    <input type="text" name="productUnit" id="productUnit" class="form-control" placeholder="productUnit" required>
                </div>
                <div class="form-group">
                    <label for="productCount">商品数量：</label>
                    <input type="text" name="productCount" id="productCount" class="form-control" placeholder="productCount" required>
                </div>
                <div class="form-group">
                    <label for="totalPrice">总金额：</label>
                    <input type="text" name="totalPrice" id="totalPrice" class="form-control" placeholder="totalPrice" required>
                </div>
                <div class="form-group">
                    <label >供应商：</label>
                    <select name="proNameSelected" id="proNameSelected" class="form-control">
                    </select>
                </div>
                <div class="form-group">
                    <label>是否付款：</label><br/>
                    <div class="radio">
                        <label for="isPayment1">
                            <input type="radio" id="isPayment1" name="isPayment" value="1" checked>未付款
                        </label>
                        <label for="isPayment2">
                            <input type="radio" id="isPayment2" name="isPayment" value="2">已付款
                        </label><br/>
                    </div>
                </div>
                <div class="form-inline">
                    <div  class="col-md-offset-4">
                        <input type="submit" class="btn btn-default" value="&emsp;添加&emsp;" onclick="show()">
                        <button type="button" class="btn btn-default">
                            <a href="${pageContext.request.contextPath}/user/billDo/billList">
                                &emsp;返回&emsp;
                            </a>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<script src="${pageContext.request.contextPath}/webjars/jquery/3.6.0/jquery.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
        integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script>

    let show = function () {
        console.log();
    }

    //初始化供应商名称下拉栏
    function selectProName() {
        $.ajax({
            url:"${pageContext.request.contextPath}/user/providerDo/getAllBillProvider",
            type:"GET",
            success:function (data) {
                let html = '';
                html = '<option value="-1" selected>========Provider========</option>';
                for (let i = 0; i < data.length; i++) {
                    let id = parseInt(data[i].id);
                    let proName = data[i].proName;
                    html += '<option value="'+id+'">'+proName+'</option>';
                }
                $('#proNameSelected').html(html);
            }
        })
    }

    $(document).ready(function () {
        selectProName();
    })

</script>

</body>
</html>
